package com.ruoyi.chat.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.jwyz.dto.TargetUserResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.chat.mapper.FollowingMapper;
import com.ruoyi.chat.domain.Following;
import com.ruoyi.chat.service.IFollowingService;

/**
 * 关注Service业务层处理
 * 
 * @author lxp
 * @date 2023-03-31
 */
@Service
public class FollowingServiceImpl  extends ServiceImpl<FollowingMapper,Following> implements IFollowingService
{
    @Autowired
    private FollowingMapper followingMapper;

    /**
     * 查询关注
     * 
     * @param id 关注主键
     * @return 关注
     */
    @Override
    public Following selectFollowingById(Long id)
    {
        return followingMapper.selectFollowingById(id);
    }

    /**
     * 查询关注列表
     * 
     * @param following 关注
     * @return 关注
     */
    @Override
    public List<Following> selectFollowingList(Following following)
    {
        return followingMapper.selectFollowingList(following);
    }

    /**
     * 新增关注
     * 
     * @param following 关注
     * @return 结果
     */
    @Override
    public int insertFollowing(Following following)
    {
        following.setCreateTime(DateUtils.getNowDate());
        return followingMapper.insertFollowing(following);
    }

    /**
     * 修改关注
     * 
     * @param following 关注
     * @return 结果
     */
    @Override
    public int updateFollowing(Following following)
    {
        following.setUpdateTime(DateUtils.getNowDate());
        return followingMapper.updateFollowing(following);
    }

    /**
     * 批量删除关注
     * 
     * @param ids 需要删除的关注主键
     * @return 结果
     */
    @Override
    public int deleteFollowingByIds(Long[] ids)
    {
        return followingMapper.deleteFollowingByIds(ids);
    }

    /**
     * 删除关注信息
     * 
     * @param id 关注主键
     * @return 结果
     */
    @Override
    public int deleteFollowingById(Long id)
    {
        return followingMapper.deleteFollowingById(id);
    }

    @Override
    public List<TargetUserResult> selectFollowingListByUserId(Long userId) {
        return followingMapper.selectFollowingListByUserId(userId);
    }
}
